package com.kgc.scd.service;

import com.kgc.scd.annotation.RequestUser;
import com.kgc.scd.bean.SignVO;
import com.kgc.scd.util.RequestResult;
import com.kgc.scd.util.UserAnno;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * Created On : 2022/6/11.
 * <p>
 * Author     : nainai
 * <p>
 * Description: 用户积分相关业务
 */
@FeignClient(value = "blmall-server-ly-8103")
public interface UserCreditService {

    /**
     * @author : nainai
     * @date   : 2022/6/11
     * @param  : [com.kgc.scd.util.UserAnno]
     * @return : com.kgc.scd.util.RequestResult<java.lang.Integer>
     * @description : 查询用户积分
     */
    @PostMapping("/queryUserCredit")
    Integer queryUserCredit(@RequestBody UserAnno user);

    /**
     * @author : nainai
     * @date   : 2022/6/11
     * @param  : [java.lang.String, java.lang.Integer]
     * @return : com.kgc.scd.util.RequestResult<java.lang.String>
     * @description : 扣减积分
     */
    @PostMapping("/creditDeduct")
    boolean creditDeduct(@RequestParam("userId") String userId, @RequestParam("credit") Integer credit);

    /**
     * @author : nainai
     * @date   : 2022/6/15
     * @param  : [com.kgc.scd.util.UserAnno, java.lang.Integer]
     * @return : boolean
     * @description : 用户增加积分
     */
    @PostMapping("/addUserCredit")
    boolean addUserCredit(@RequestParam("userId") String userId, @RequestParam("credit") Integer credit);

    /**
     * @author : nainai
     * @date   : 2022/6/11
     * @param  : [java.lang.String]
     * @return : com.kgc.scd.util.RequestResult<java.lang.String>
     * @description : 用户签到 
     */
    @PostMapping("/userSign")
    Map<String, String> consecutiveSign(@RequestParam("userId") String userId);

    /**
     * @author : nainai
     * @date   : 2022/6/16
     * @param  : [java.lang.String, java.lang.Integer, java.lang.Integer]
     * @return : java.util.List<com.kgc.scd.bean.SignVO>
     * @description : 查询用户签到流水
     */
    @GetMapping("/queryUserSignRecord")
    List<SignVO> queryUserSignRecord(@RequestParam("userId") String userId, @RequestParam("year") Integer year, @RequestParam(value = "month", required = false) Integer month);
}

